[ContributorDoc] Checklist for adding new LSP/BSP messages#2626
Conversation
|
@swift-ci Please test |
|
|
||
| - [ ] Add the request Swift file under `Sources/LanguageServerProtocol/Requests/` | ||
| - [ ] `Sources/LanguageServerProtocol/CMakeLists.txt` — add the file in alphabetical order | ||
| - [ ] `Sources/LanguageServerProtocol/Messages.swift` — add to `builtinRequests` |
There was a problem hiding this comment.
This tend to be missed because our test cases don't go through this. We should fix that...
| - [ ] `Sources/SourceKitLSP/MessageHandlingDependencyTracker.swift` — add a case to `init(_ request:)` to declare the dependency type (`.freestanding`, `.documentRequest(uri)`, etc.) *(client → server only)* | ||
| - [ ] `Sources/SourceKitLSP/SourceKitLSPServer.swift`: | ||
| - [ ] *(client → server)* Add a case to the main request dispatch switch and implement the handler | ||
| - [ ] *(server → client)* Call `client.send(request)` from the appropriate place |
There was a problem hiding this comment.
I’m not sure if we need this. I mean, if you want to use it, you have to send the request, otherwise there’s just no point.
| - [ ] `Contributor Documentation/LSP Extensions.md` — document the request | ||
| - [ ] Add tests | ||
|
|
||
| ## LSP Notification |
There was a problem hiding this comment.
Should we unify this with the LSP Requests section? Most of it is duplicated.
| - [ ] `Sources/SourceKitLSP/SourceKitLSPServer.swift`: | ||
| - [ ] *(client → server)* Add a case to the main request dispatch switch and implement the handler | ||
| - [ ] *(server → client)* Call `client.send(request)` from the appropriate place | ||
| - [ ] If experimental: advertise via `serverCapabilities()` and guard with a capability check *(client → server)*; check the client capability before sending *(server → client)* |
There was a problem hiding this comment.
We need to advertise the request from both SourceKitLSPServer.serverCapabilities and SwiftLangaugeService.initialize.
| - [ ] If experimental: advertise via `serverCapabilities()` and guard with a capability check *(client → server)*; check the client capability before sending *(server → client)* | ||
| - [ ] `Sources/SourceKitLSP/CapabilityRegistry.swift` — if gated on an experimental **client** capability, add a helper property *(client → server only)* | ||
| - [ ] `Contributor Documentation/LSP Extensions.md` — document the request | ||
| - [ ] Add tests |
There was a problem hiding this comment.
I don’t think we should explicitly need to mention this. Tests should be added to every change, no matter what.
| - [ ] `Sources/BuildServerIntegration/BuildServerMessageDependencyTracker.swift` — add a case to the dependency tracking switch | ||
| - [ ] `Sources/BuildServerIntegration/BuiltInBuildServer.swift` — add the handler method to the `BuiltInBuildServer` protocol | ||
| - [ ] `Sources/BuildServerIntegration/BuiltInBuildServerAdapter.swift` — add a case to the request dispatch switch | ||
| - [ ] Implement the handler in all `BuiltInBuildServer` conformers: |
There was a problem hiding this comment.
I don’t think we need to explicitly spell this out. Adding the requirement to BuiltInBuildServer will prompt theses.
53769e4 to
a2da4b9
Compare
ahoppen
left a comment
There was a problem hiding this comment.
Some more nitpicks, otherwise looks good.
| - [ ] If handled by a language service: also advertise in each `LanguageService.initialize` conforming method | ||
| - [ ] If experimental *(server → client)*: check the client capability before sending | ||
| - [ ] `Sources/SourceKitLSP/CapabilityRegistry.swift` — if gated on an experimental **client** capability, add a helper property | ||
| - [ ] `Contributor Documentation/LSP Extensions.md` — document if it is a SourceKit-LSP extension |
There was a problem hiding this comment.
| - [ ] `Contributor Documentation/LSP Extensions.md` — document if it is a SourceKit-LSP extension | |
| - [ ] `Contributor Documentation/LSP Extensions.md` — document if it is an LSP extension |
| - [ ] `Sources/BuildServerIntegration/BuildServerMessageDependencyTracker.swift` — add a case to the dependency tracking switch *(request only)* | ||
| - [ ] `Sources/BuildServerIntegration/BuiltInBuildServer.swift` — add the handler method to the `BuiltInBuildServer` protocol *(request only)* | ||
| - [ ] `Sources/BuildServerIntegration/BuiltInBuildServerAdapter.swift` — add a case to the request dispatch switch *(request only)* | ||
| - [ ] *(SourceKit-LSP → build server, notification only)* Send via `buildServerManager.send(notification)` from the appropriate place; if built-in servers also need to react, add a case to `BuiltInBuildServerAdapter.handle(notification:)` |
There was a problem hiding this comment.
Similar to my comment in LSP: I don’t think we need to document that you need to send the request if you want to send it.
| - [ ] `Sources/BuildServerIntegration/BuiltInBuildServerAdapter.swift` — add a case to the request dispatch switch *(request only)* | ||
| - [ ] *(SourceKit-LSP → build server, notification only)* Send via `buildServerManager.send(notification)` from the appropriate place; if built-in servers also need to react, add a case to `BuiltInBuildServerAdapter.handle(notification:)` | ||
| - [ ] *(build server → SourceKit-LSP, notification only)* `Sources/BuildServerIntegration/BuildServerManager.swift` — add a case to `handle(notification:)` and implement the handler | ||
| - [ ] `Contributor Documentation/BSP Extensions.md` — document if it is a SourceKit-LSP extension |
There was a problem hiding this comment.
| - [ ] `Contributor Documentation/BSP Extensions.md` — document if it is a SourceKit-LSP extension | |
| - [ ] `Contributor Documentation/BSP Extensions.md` — document if it is a BSP extension |
a2da4b9 to
6598efb
Compare
6598efb to
41f2146
Compare
|
@swift-ci Please test |
|
@swift-ci Please test Windows |
|
Thank you for adding this doc, Rintaro! |
Because I keep forgetting these.